package com.helloandroid.dialogs

import android.app.Activity
import android.content.Context
import android.widget.TextView
import com.helloandroid.AppUtil
import com.helloandroid.R
import com.helloandroid.ads.SmallNativeAdUtil
import com.helloandroid.base.BaseDialog
import java.text.DecimalFormat

class MoneyDialog(ctx: Context, private val awardMoneyCount:Int) : BaseDialog(ctx) {

    lateinit var tvAward:TextView
    lateinit var tvMyMoney:TextView

    override fun getContentViewResId(): Int = R.layout.dialog_money

    override fun initView() {
        tvAward = findViewById(R.id.tvAward)
        tvMyMoney = findViewById(R.id.tvMyMoney)

        val money = AppUtil.user.money
        val textFromat = DecimalFormat("0.00")
        tvAward.text = "恭喜获得${textFromat.format(awardMoneyCount/10000f)}元"
        tvMyMoney.text = "${textFromat.format(money / 10000f)}元"

        findBtn(R.id.btnOk).setOnClickListener { cancel() }

        //
        SmallNativeAdUtil.showNativeAd(ctx as Activity,findViewById(R.id.nativeView))
    }

    override fun initData() {
    }
}